package com.wangcang.widgetlibrary.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.CompoundButton;
import android.widget.TextView;

import com.wangcang.widgetlibrary.R;
import com.wangcang.widgetlibrary.switchbutton.SwitchCheckBox;

public class SwitchButtonActivity extends AppCompatActivity {

	private SwitchCheckBox mSwitchCheckBox;
	private TextView mTv;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_switch_button);
		mSwitchCheckBox = (SwitchCheckBox) findViewById(R.id.switch_button);
		mTv = (TextView) findViewById(R.id.tv);
		mTv.setText("" + mSwitchCheckBox.isChecked());
		mSwitchCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				mTv.setText("" + isChecked);
			}
		});
	}
}
